<?

if (null==$listfield1) $listfield1 = "code";
if (null==$listfield2) $listfield2 = "name";

if ($Search){

	$Query = "select id, $listfield1, $listfield2, $listfield3, $listfield4, $listfield5 from $table WHERE region Like '%$Search%' or regionc like '%$Search%'   order by  $listfield1, $listfield2, $listfield3 desc Limit $Offset, $ListNum";

	$Query1 = "select count(*) as total from $table WHERE region Like '%$Search%' or regionc like '%$Search%'";

}else{

	$Query = "select id, $listfield1, $listfield2, $listfield3, $listfield4, $listfield5 from $table order by  $listfield1,$listfield2, $listfield3 Limit $Offset, $ListNum";

	$Query1 = "select count(*) as total from $table";
	
}

$list = myQuery($Query);

$sql="select value from misc_data where name='express';";
$r=myQuery($sql);


$CountRecord = myQuery($Query1);

$CountNum = $CountRecord[0][0];
$Url="&Search=".urlencode($Search)."&action=$action";	


print(splitPage($Url,$CountNum));

?>


        <table width="100%" border="0" cellspacing="1" cellpadding="1" class="tb">
          <tr class="tbheader"> 
            <td width="25%"><?print(ucfirst($listfield1))?></td>
            <td width="10%"><?print(ucfirst($listfield2))?></td>
            <td width="15%">Weight (kg) from</td>
            <td width="15%">Weight (kg) to</td>
            <td width="15%">Charge (HKD)</td>
			<td width="20%"></td>
          </tr>


<?
if ($list){
	for ($i=0;$i<count($list);$i++){

	if (strpos(strtoupper($list[$i][1]),'HONG KONG')===false && $list[$i][2]=='Express') $list[$i][5]=round($list[$i][5]*(100+$r[0][0])/100,2);
?>
          <tr class="tbcontent1"> 
            <td><?print($list[$i][1])?></td>
            <td align=center><?print($list[$i][2])?></td>
            <td align=center><?print($list[$i][3])?></td>
            <td align=center><?print($list[$i][4])?></td>
            <td align=right><?print(number_format($list[$i][5],2))?></td>
			<td align=center bgcolor="ECECEC">
			<a href="edit.php?Start_Num=<?echo $Start_Num?>&id=<?print($list[$i][0])?>&Search=<?=urlencode($Search)?>"><img src="<?print($rela_path)?>images/bt_edit.gif" border="0" alt="Edit"></a>
			<a href="delete.php?id=Start_Num=<?echo $Start_Num?>&id=<?print($list[$i][0])?>&Search=<?=urlencode($Search)?>"><img src="<?print($rela_path)?>images/bt_delete.gif" border="0" Alt="Delete"></a>
			<a href="enquire.php?id=Start_Num=<?echo $Start_Num?>&id=<?print($list[$i][0])?>&Search=<?=urlencode($Search)?>"><img src="<?print($rela_path)?>images/bt_enquiry.gif" border="0" Alt="Enquire"></a></td>
          </tr>
<?
	}	
}?>


        </table>

<?print(splitPage($Url,$CountNum))?>
